package com.amorcloud.pig.widget;

import android.app.Dialog;
import android.content.Context;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.amorcloud.pig.R;

public class UploadSuccessDialog {

    public static Dialog CreateUploadSuccessDialog(Context context, int successCount) {
        final Dialog dialog = new Dialog(context);
        View view = LayoutInflater.from(context).inflate(R.layout.dialog_success, null);
        TextView successMsg = view.findViewById(R.id.upload_success_count);
        successMsg.setText(Html.fromHtml("总数<font color='#FF0000'>" + successCount + "</font>条"));
        ImageView close = view.findViewById(R.id.img_close);
        close.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });
        dialog.setContentView(view);
        return dialog;
    }

    public static Dialog CreateCheckSuccessDialog(Context context, int successCount) {
        final Dialog dialog = new Dialog(context);
        View view = LayoutInflater.from(context).inflate(R.layout.dialog_check_success, null);
        TextView successMsg = view.findViewById(R.id.check_success_count);
        Button sureButton = view.findViewById(R.id.btn_sure);
        sureButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });
        successMsg.setText(Html.fromHtml("当前盘点数量为<font color='#FF0000'>" + successCount + "</font>只"));
        dialog.setContentView(view);
        return dialog;
    }

    public static Dialog CreateSellSuccessDialog(Context context, int successCount) {
        final Dialog dialog = new Dialog(context);
        View view = LayoutInflater.from(context).inflate(R.layout.dialog_check_success, null);
        TextView msg1 = view.findViewById(R.id.check_msg1);
        msg1.setText("猪只销售完成");
        TextView successMsg = view.findViewById(R.id.check_success_count);
        successMsg.setText(Html.fromHtml("当前销售数量为<font color='#FF0000'>" + successCount + "</font>只"));
        ImageView close = view.findViewById(R.id.img_close);
        close.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });
        dialog.setContentView(view);
        return dialog;
    }

}
